package com.github.yuweiguocn.demo.greendao.db;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.github.yuweiguocn.demo.greendao.db.Group;
import com.github.yuweiguocn.demo.greendao.db.TestData2;
import com.github.yuweiguocn.demo.greendao.db.TestData3;

import com.github.yuweiguocn.demo.greendao.db.GroupDao;
import com.github.yuweiguocn.demo.greendao.db.TestData2Dao;
import com.github.yuweiguocn.demo.greendao.db.TestData3Dao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig groupDaoConfig;
    private final DaoConfig testData2DaoConfig;
    private final DaoConfig testData3DaoConfig;

    private final GroupDao groupDao;
    private final TestData2Dao testData2Dao;
    private final TestData3Dao testData3Dao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        groupDaoConfig = daoConfigMap.get(GroupDao.class).clone();
        groupDaoConfig.initIdentityScope(type);

        testData2DaoConfig = daoConfigMap.get(TestData2Dao.class).clone();
        testData2DaoConfig.initIdentityScope(type);

        testData3DaoConfig = daoConfigMap.get(TestData3Dao.class).clone();
        testData3DaoConfig.initIdentityScope(type);

        groupDao = new GroupDao(groupDaoConfig, this);
        testData2Dao = new TestData2Dao(testData2DaoConfig, this);
        testData3Dao = new TestData3Dao(testData3DaoConfig, this);

        registerDao(Group.class, groupDao);
        registerDao(TestData2.class, testData2Dao);
        registerDao(TestData3.class, testData3Dao);
    }
    
    public void clear() {
        groupDaoConfig.clearIdentityScope();
        testData2DaoConfig.clearIdentityScope();
        testData3DaoConfig.clearIdentityScope();
    }

    public GroupDao getGroupDao() {
        return groupDao;
    }

    public TestData2Dao getTestData2Dao() {
        return testData2Dao;
    }

    public TestData3Dao getTestData3Dao() {
        return testData3Dao;
    }

}
